export default  function clone(obj, cloneObj) {
  var newObj = cloneObj || [];

  for (var key in obj) {
    if (typeof obj[key] == "object" && obj[key] != null) {
      newObj[key] = Array.isArray(obj[key]) ? [] : {};
      if (obj[key] instanceof ArrayBuffer) {
            newObj[key] = obj[key];
      } else {
        clone(obj[key], newObj[key]);
      }
    } else {
      newObj[key] = obj[key];
    }
  }

  return newObj;
}
